<template>
  <div class="standard-wrap">
    <slot></slot>
  </div>
</template>
<script lang="ts" setup>
import { withDefaults, defineProps, nextTick, defineEmits, computed, provide, inject } from 'vue';
import formMitt from '@/hooks/mybus';
import { MITT_KEY } from '@/components/CFormDetail';
interface IProps {
  modelValue: string;
}
const props = withDefaults(defineProps<IProps>(), {
  modelValue: ''
});
const modelVal = computed({
  get() {
    return props.modelValue;
  },
  set(val) {
    changeEvent(val);
  }
});
const emit = defineEmits(['update:modelValue', 'change']);
const changeEvent = (value: any) => {
  // 触发清除校验
  formMitt.emit('MITT_KEY', { name: 'standard' });
  emit('update:modelValue', value);
  nextTick(() => {
    emit('change', value);
  });
};
provide('CStandardRadioGroup', {
  name: 'CStandardRadioGroup',
  modelVal,
  changeEvent
});
</script>
<style lang="scss" scoped>
@use '../styles/index.scss' as *;
</style>
